package cn.itsource.pet.controller;

import cn.itsource.basic.util.PageList;
import cn.itsource.pet.domain.PetDetail;
import cn.itsource.pet.query.PetDetailQuery;
import cn.itsource.pet.service.IPetDetailService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 宠物详情控制器
 */
@RestController
@RequestMapping("/petDetail")
@Api(tags = "宠物详情管理", description = "宠物详情操作接口")
public class PetDetailController {

    @Autowired
    private IPetDetailService petDetailService;


    /**
     * 查询所有
     */
    @PostMapping("/findPage")
    public PageList<PetDetail> find(@RequestBody PetDetailQuery petDetailQuery){
        //查询分页数据
        return petDetailService.findPage(petDetailQuery);
    }

    /**
     * 根据宠物id查询详情对象
     */
    @PostMapping("/findByPetId/{petId}")
    public PetDetail findByPetId(@PathVariable("petId") Long petId){
        //查询分页数据
        return petDetailService.selectByPetId(petId);
    }
    

    /**
     * 新增或修改的操作
     * 根据id来区分新增和修改
     * 怎么区分请求使用的请求方式  这里是post
     */
    /*@PostMapping
    public AjaxResult update(@RequestBody @Valid Pet pet){

        petDetailService.saveOrUpdate(pet);
        return AjaxResult.createSuccess();

    }*/

}
